﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eDream.Page
{
    public partial class chitiethoahong : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                dteMonth.Value = DateTime.Now.Month;
                dteYear.Value = DateTime.Now.Year;
                bindata();
            }
        }

        protected void ASPxCallbackPanel1_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            bindata();
        }

        void bindata()
        {
            UserDB user_obj = (UserDB)Session[Global.SESS_USER];
            DataClasses1DataContext dx = new DataClasses1DataContext();
            int month = DateTime.Now.Month;
            int year = DateTime.Now.Year;
            if (dteMonth.Value != null && !dteYear.Value.Equals(null))
            {
                month = int.Parse(dteMonth.Value.ToString());
                year = int.Parse(dteYear.Value.ToString());
            }
            var list = from k in dx.log_Hoahongs
                       where k.month == month && k.year == year && k.parentID == user_obj.ID
                       select new { k.Id, k.n1, k.n2, k.n3, k.n4, k.n5, k.n6, k.n7, k.n8, k.n9, k.n10, k.tientra };

            grvResult.DataSource = list;
            grvResult.DataBind();

        }

        protected void btnTim_Click(object sender, EventArgs e)
        {
            bindata();
        }
    }
}